<template>
  <div class="son">
    <h3>我是Son组件,汽车信息为：{{ name }}---{{ price }}</h3>
  </div>
</template>
  
<script>
import { inject, toRefs } from 'vue';
export default {
  name: "Son",
  setup()
  {
    let car=inject('car')
    return{
        ...toRefs(car)
    }
  }
};
</script>
  
  <style scoped>
.son {
  background-color:aquamarine;
  padding: 10px;
}
</style>